package com.erpanderp.wam.ac.view.project;
import java.io.Serializable;
	import java.util.ArrayList;
	import java.util.Date;
	import java.util.HashMap;
	import java.util.HashSet;
	import java.util.List;
	import java.util.Map;
	import java.util.Set;
import java.util.TimeZone;

	import javax.faces.application.FacesMessage;
	import javax.faces.bean.ManagedBean;
	import javax.faces.bean.ViewScoped;
	import javax.faces.context.FacesContext;
	import javax.faces.event.ActionEvent;
	import javax.faces.event.AjaxBehaviorEvent;
	import javax.servlet.ServletContext;
	import javax.servlet.http.HttpServletRequest;
	import javax.servlet.http.HttpSession;
import javax.swing.SwingWorker;

	import org.primefaces.component.datatable.DataTable;
	import org.primefaces.component.selectonemenu.SelectOneMenu;
	import org.primefaces.context.RequestContext;
import org.primefaces.event.RowEditEvent;

	import com.erpanderp.wam.ac.model.entity.project.Journey;
	import com.erpanderp.wam.ac.model.entity.project.ProjectAssignment;
	import com.erpanderp.wam.ac.model.entity.project.ProjectAssignmentDetail;
	import com.erpanderp.wam.ac.model.entity.project.VISA;
	import com.erpanderp.wam.ac.model.service.project.JourneyDAO;
	import com.erpanderp.wam.ac.model.service.project.ProjectAssignmentDAO;
	import com.erpanderp.wam.ac.model.service.project.ProjectAssignmentDetailDAO;
	import com.erpanderp.wam.ac.model.service.project.VisaDAO;

	import com.erpanderp.wam.adm.model.entity.Resource;
	import com.erpanderp.wam.tm.model.entity.RecruitmentProfile;
import com.erpanderp.wam.usm.model.entity.projectandassignment.EmployeeProject;
	import com.erpanderp.wam.usm.model.entity.projectandassignment.Project;
	import com.erpanderp.wam.usm.model.entity.user.Employee;
	import com.erpanderp.wam.usm.model.entity.user.PassportAndPANDetails;
	import com.erpanderp.wam.usm.model.entity.user.WAMUser;
import com.erpanderp.wam.usm.model.service.projectandassignment.EmployeeProjectDAO;
	import com.erpanderp.wam.usm.model.service.projectandassignment.ProjectDAO;
	import com.erpanderp.wam.util.CommonLookup;
import com.erpanderp.wam.util.EmailUtil;
import com.erpanderp.wam.util.ValidationUtil;
import com.erpanderp.wam.util.WAMHostManager;
	@ManagedBean
	@ViewScoped
	public class ApproveInternationalProjectAssignmentBean implements Serializable {

		private static final long serialVersionUID = 1L;
		HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
		HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
		ServletContext context = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
		
		String projectAssignmentId = request.getParameter("projectAssignmentId");
	    String employeeId = request.getParameter("employeeId");
		
	    ProjectDAO projectDAO = new ProjectDAO();
		ProjectAssignmentDAO projectAssignmentDAO = new ProjectAssignmentDAO();
		ProjectAssignmentDetailDAO projectAssignmentDetailDAO = new ProjectAssignmentDetailDAO();
		JourneyDAO journeyDAO = new JourneyDAO();
		VisaDAO visaDAO = new VisaDAO();
		JourneyDAO onwardJourneyDAO = new JourneyDAO();
		JourneyDAO returnJourneyDAO = new JourneyDAO();
		

		
		private ProjectAssignment projectAssignment = new ProjectAssignment();
		private ProjectAssignmentDetail projectAssignmentDetail = new ProjectAssignmentDetail();
		private Journey onwardJourney = new Journey();
		private Journey returnJourney = new Journey();
		private VISA visa = new VISA();

		private Employee employee = new Employee();
		private Project selectedProject= new Project();
		private WAMUser wamUser = (WAMUser) session.getAttribute(CommonLookup.SESSION_ATTRIBUTE_WAMUSER);
		private Employee reportingManager;
		private EmailUtil emailUtil = new EmailUtil();
		
		private boolean SHOW_EDIT_DIALOG=false;
		private boolean FORM_VALID;
		private boolean renderApproveReject;
		private boolean renderUpdate;
		private boolean renderClose;
		private boolean renderProjectsAssignmentsList;
		private boolean renderProjectsAssignments;
		private boolean renderApprove;
		private boolean renderRecommend;
		private boolean renderReject;
		
		private List<ProjectAssignment> projectAssignmentsList = new ArrayList<ProjectAssignment>();
		private List<ProjectAssignmentDetail> projectAssignmentDetailList = new ArrayList<ProjectAssignmentDetail>();
		private List<PassportAndPANDetails> passportAndPANDetailsList = new ArrayList<PassportAndPANDetails>();
		private List<Journey> onwardJourneyDetails = new ArrayList<Journey>();
		private List<Journey> returnJourneyDetails = new ArrayList<Journey>();
		private List<Journey> onwardJournies = new ArrayList<Journey>();
		private List<Journey> returnJournies = new ArrayList<Journey>();
		private List<Journey> availableOnwardJourneyDetails = new ArrayList<Journey>();
		private List<Journey> availableReturnJourneyDetails = new ArrayList<Journey>();
		private List<Project> projects = new ArrayList<Project>();
		
		private Set<Journey> onwardJourneyDetailsSet = new HashSet<Journey>();
		private Set<Journey> returnJourneyDetailsSet = new HashSet<Journey>();
		
		private EmployeeProject  employeeProject = new EmployeeProject();
		EmployeeProjectDAO employeeProjectDAO = new EmployeeProjectDAO();
		
		private List<EmployeeProject> employeeProjects = new ArrayList<EmployeeProject>();
		
		Map<String, Long> projectsMap = new HashMap<String, Long>();
	    
		private DataTable availableOnwordJourneyDetailsTable;
		private DataTable availableReturnJourneyDetailsTable;
		
	    private Long selectedProjectId;
		private String projectAssignmentCode;
		private String contactNumber="";
		private String passportNumber;
		private String approvedBy="";
		private Float advanceAmount;
		private Float roomRentAdvance;
		private Date createDate;
		private String additionals;
		String EMAIL_MESSAGE;
		private TimeZone defaultTimeZone = TimeZone.getDefault();
		
		public ApproveInternationalProjectAssignmentBean() 
		{
			// TODO Auto-generated constructor stub
			System.out.println("constructor start.................ApproveInternationalProjectAssignmentBean");
			setWamUser((WAMUser) session.getAttribute(CommonLookup.SESSION_ATTRIBUTE_WAMUSER));
			projectAssignmentCode=CommonLookup.getAutoGeneratedInternationalProjectAssignmentCode(wamUser.getEmployee().getEmployeeCode());
			System.out.println("InternationalProjectAssignmentId.........."+projectAssignmentCode);
			setCreateDate(new Date());
			employee.setFirstName(wamUser.getEmployee().getFirstName());
			employee.setLastName(wamUser.getEmployee().getLastName());
			setEmployeeId(wamUser.getEmployee().getEmployeeCode());
			//wamUser.getEmployee().getNewJoinee().getPassportAndPANDetails();
			setPassportNumber("AD45567H890");
			//passportAndPANDetailsList.addAll(wamUser.getEmployee().getNewJoinee().getPassportAndPANDetails());
			//for(PassportAndPANDetails passportAndPANDetails : passportAndPANDetailsList){
			//	setPassportNumber(passportAndPANDetails.getPassportNumber());
			//	System.out.println("passportAndPANDetails.getPassportNumber()............"+passportAndPANDetails.getPassportNumber());
			//}
			setContactNumber(wamUser.getEmployee().getTelephone());
			setApprovedBy(CommonLookup.PROJECTASSIGNMENT_DOMESTIC_INTERNATIONAL_APPROVER);
			//LOADING PROJECTS
			employeeProjects = employeeProjectDAO.getAllEmployeeProjects(wamUser.getEmployee().getEmployeeId());
			  for(EmployeeProject employeeProject :employeeProjects)
			  {
				  projectsMap.put(employeeProject.getProject().getProjectName(), employeeProject.getProject().getProjectId());
			  }
			System.out.println("MAP: " + projectsMap);
			
			projectAssignment = projectAssignmentDAO.getProjectAssignmentByProjectAssignmentId(Long.parseLong(projectAssignmentId));
			
			onwardJourneyDetails = journeyDAO.getOnwardJourneyDetailsByProjectAssignmentIdJourneyType(projectAssignment.getProjectAssignmentId(), CommonLookup.JOURNEY_TYPE_ONWARD);
			System.out.println("availableOnwardJourneyDetails size: " + onwardJourneyDetails.size());
			returnJourneyDetails = journeyDAO.getReturnJourneyDetailsByProjectAssignmentIdJourneyType(projectAssignment.getProjectAssignmentId(), CommonLookup.JOURNEY_TYPE_RETURN);
			System.out.println("availableReturndJourneyDetails size: " + returnJourneyDetails.size());
			
			List<VISA> tempList = new ArrayList<VISA>();
			tempList.addAll(projectAssignment.getVisaDetails());
			visa = tempList.get(0);
			
//			List<VISA> visaDetails = new ArrayList<VISA>();
//			visaDetails.addAll(visaDAO.getVisaDetailsByProjectAssignmentId(projectAssignment.getProjectAssignmentId()));
//			visa = visaDetails.get(0);
//			visaDetails = visaDAO.getVisaDetailsByProjectAssignmentId(projectAssignment.getProjectAssignmentId());
//			System.out.println("visaDetails size: " + visaDetails.size());
			
			if(projectAssignment.getRecommendationStatus().equals("INPROCESS") && projectAssignment.getApprovalStatus().equals("INPROCESS"))
			{
			System.out.println("recommended1..........."+projectAssignment.getRecommendationStatus());
			System.out.println("approve1..........."+projectAssignment.getApprovalStatus());
			setRenderRecommend(true);
			setRenderApprove(false);
			setRenderReject(true);
			}
			if(projectAssignment.getRecommendationStatus().equals("RECOMMENDED") && projectAssignment.getApprovalStatus().equals("INPROCESS"))
			{
			System.out.println("recommended2..........."+projectAssignment.getRecommendationStatus());
			System.out.println("approve2..........."+projectAssignment.getApprovalStatus());
			setRenderRecommend(false);
			setRenderApprove(true);
			setRenderReject(true);
			}
			

		}
		
        //DISPLAY PROJECT BY SELECTED PROJECT
		public void projectChangeListener(AjaxBehaviorEvent e) 
		{
			selectedProjectId = Long.parseLong(((SelectOneMenu)e.getComponent()).getValue().toString());
			System.out.println(selectedProjectId);
			projectAssignment.setProject(projectDAO.getProjectByProjectID(selectedProjectId));
	     }
		
		//ADD ONWARD JOURNEY
		public String reinitOnward() 
		{  
		System.out.println("In reinitOnward.....");
		 validateFormOnward();
			if(FORM_VALID){
		onwardJourney.setModifiedBy(wamUser.getEmployee().getFirstName() +" "+ wamUser.getEmployee().getLastName());
		onwardJourney.setDateModified(new Date());
		onwardJourney.setJourneyType(CommonLookup.JOURNEY_TYPE_ONWARD);
		onwardJourney.setStatus(CommonLookup.STATUS_ACTIVE);
		onwardJourney.setProjectAssignment(projectAssignment);
		projectAssignment.getOnwardJourneyDetails().add(onwardJourney);
		onwardJourney = new Journey();
			}
		return null;  
		} 
		//VALIDATION FOR ONWARD JOURNEY
		private void validateFormOnward()
		{
			System.out.println("validateForm.....................");
			FORM_VALID = true;

			System.out.println("onwardJourney.getModeOfTravel()....................."+onwardJourney.getModeOfTravel());

			if(onwardJourney.getModeOfTravel().equals("Choose One"))
		{
				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Choose Mode of travel for onward journey ", ""));
			FORM_VALID = false;
		}
		if(ValidationUtil.isEmpty(String.valueOf(onwardJourney.getNameOfCarrier()), "Name of carrier for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(String.valueOf(onwardJourney.getCarrierId()), "CarrierId for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(String.valueOf(onwardJourney.getSource()), "From for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(String.valueOf(onwardJourney.getDestination()), "To for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(onwardJourney.getDepartureDate() != null ? onwardJourney.getDepartureDate().toString() :null , "Departure date for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(onwardJourney.getArrivalDate() != null ? onwardJourney.getArrivalDate().toString() :null , "Arrival date for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(onwardJourney.getDepartureTime() != null ? onwardJourney.getDepartureTime().toString() :null , "Departure time for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}

		if(ValidationUtil.isEmpty(onwardJourney.getArrivalTime() != null ? onwardJourney.getArrivalTime().toString() :null , "Arrival time for onward journey ", null, FacesContext.getCurrentInstance()) != null){
			FORM_VALID = false;
		}
		if(onwardJourney.getDepartureDate() != null && onwardJourney.getArrivalDate() != null )
		{
			if(onwardJourney.getDepartureDate().compareTo(onwardJourney.getArrivalDate())>0){	
				System.out.println("FROMDATE is after TODATE");
				FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN," Departure Date should not be more than Arrival Date in onward journey", ""));
				FORM_VALID = false;
			}
		}
				

		}

		
		//REMOVE ONWARD JOURNEY
		public void removeFromOnwardJourneyList(ActionEvent e){
			Journey onwardJourney  = (Journey) availableOnwordJourneyDetailsTable.getRowData();		
			onwardJourneyDetails.remove(onwardJourney);
			onwardJourneyDAO.deleteSelectedOnwardJourney(onwardJourney);
		}
		
		//ADD RETURN JOURNEY
	  public String reinitReturn() 
	  {  
		  	System.out.println("In reinitReturn.....");
		  	validateFormReturn();
			if(FORM_VALID){
			returnJourney.setModifiedBy(wamUser.getEmployee().getFirstName() +" "+ wamUser.getEmployee().getLastName());
			returnJourney.setDateModified(new Date());
			returnJourney.setJourneyType(CommonLookup.JOURNEY_TYPE_RETURN);
			returnJourney.setStatus(CommonLookup.STATUS_ACTIVE);
			returnJourney.setProjectAssignment(projectAssignment);
			projectAssignment.getReturnJourneyDetails().add(returnJourney);
			returnJourney = new Journey();
			}
			return null;  
		} 
	  
	  private void validateFormReturn()
		{
			System.out.println("validateForm.....................");
			FORM_VALID = true;
			if(returnJourney.getModeOfTravel().equals("Choose One"))
			{
					FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Choose Mode of travel for return journey ", ""));
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(String.valueOf(returnJourney.getNameOfCarrier()), "Name of carrier for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(String.valueOf(returnJourney.getCarrierId()), "CarrierId for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(String.valueOf(returnJourney.getSource()), "From for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(String.valueOf(returnJourney.getDestination()), "To for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(returnJourney.getDepartureDate() != null ? returnJourney.getDepartureDate().toString() :null , "Departure date for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(returnJourney.getArrivalDate() != null ? returnJourney.getArrivalDate().toString() :null , "Arrival date for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(returnJourney.getDepartureTime() != null ? returnJourney.getDepartureTime().toString() :null , "Departure time for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			
			if(ValidationUtil.isEmpty(returnJourney.getArrivalTime() != null ? returnJourney.getArrivalTime().toString() :null , "Arrival time for return journey ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(returnJourney.getDepartureDate() != null && returnJourney.getArrivalDate() != null )
			{
			if(returnJourney.getDepartureDate().compareTo(returnJourney.getArrivalDate())>0){
				
	  		System.out.println("FROMDATE is after TODATE");
	  		FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN," Departure Date should not be more than Arrival Date in return journey", ""));
	  		FORM_VALID = false;
	  	}
			}
		}
	
	//REMOVE RETURN JOURNEY
	  public void removeFromReturnJourneyList(ActionEvent e)		
		{
			Journey returnJourney = (Journey) availableReturnJourneyDetailsTable.getRowData();		
			returnJourneyDetails.remove(returnJourney);
			returnJourneyDAO.deleteSelectedReturnJourney(returnJourney);
		}
		  
	
	  
	 
		//RECOMMEND ACTION
		public String recommendInternationalProjectAssignment()
		{
			System.out.println("In  recommendDomesticProjectAssignment");
			validateFormRecommend();
			if(FORM_VALID){
				setEmailUtil(new EmailUtil());
	 			projectAssignment.setRecommendationStatus(CommonLookup.PROJECT_ASSIGNMENT_RECOMMENDATIONSTATUS_STATUS);
	 			if(projectAssignmentDAO.updateInternationalProjectAssignment(projectAssignment) != null ){
	 			System.out.println("In recommend success....");
	 			System.out.println("AT CALLER METHOD: " + sendMessage());
				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, projectAssignment.getProjectAssignmentId() + " ProjectAssignment recommended successfully.", ""));
				System.out.println("In recommend success....after");
				projectAssignment = new ProjectAssignment();
				projectAssignment.setProject(new Project());
				}else{
	 				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Failed to recommend ProjectAssignment.", ""));
	 			}
			}
			return null;
		}
		
		//RECOMMEND MAIL
		public String sendMessage(){
			Map<String, String> hostsMap = WAMHostManager.getWAMHosts(context);
			String domainName = context.getInitParameter("domainName");
			
			if(hostsMap.get(CommonLookup.DEV_EMAIL) == null){
				String[] to = {CommonLookup.PROJECTASSIGNMENT_DOMESTIC_INTERNATIONAL_APPROVER_EMAIL};
				emailUtil.setRecieverAddresses(to);
			}else{
				String[] to = {hostsMap.get(CommonLookup.DEV_EMAIL)};
				emailUtil.setRecieverAddresses(to);
			}
			
			String requestURL = "ac/project/approveinternationalprojectassignment.html";
			String privateLink = "http://" + hostsMap.get(CommonLookup.PRIVATEHOST) + "/" + domainName + "/" + requestURL+"?projectAssignmentId="+projectAssignment.getProjectAssignmentId()+"&RECOMMENDATIONSTATUS="+CommonLookup.PROJECT_ASSIGNMENT_RECOMMENDATIONSTATUS_STATUS;
			String publicLink = "http://" + hostsMap.get(CommonLookup.PUBLICHOST) + "/"	+ domainName + "/" + requestURL+"?projectAssignmentId="+projectAssignment.getProjectAssignmentId()+"&RECOMMENDATIONSTATUS="+CommonLookup.PROJECT_ASSIGNMENT_RECOMMENDATIONSTATUS_STATUS;
			String messageString = "Dear " + CommonLookup.PROJECTASSIGNMENT_DOMESTIC_INTERNATIONAL_APPROVER + ",<br /><br />" + 
						"<a style='color:#FF9933;font-weight: bold;' href=\""+
						privateLink + "\">" + "Please click here to approve/reject international project assignment"+" "+projectAssignment.getProjectAssignmentCode() + "</a /><br /><br />"+
						"(Employees who are in Hyderabad office)"+"<br />"+
						"<a style='color:#FF9933;font-weight: bold;' href=\""+
						publicLink + "\">" + "Please click here to approve/reject international project assignment"+" "+projectAssignment.getProjectAssignmentCode() + "</a /><br />"+
						"(Out side of Hyderabad office)"+"<br /><br />"+
					    "Thanks & Regards, <br />"
					    + CommonLookup.WAM_DEVTEAM_SIGNATURE;
			
			emailUtil.setMessage(messageString);
			emailUtil.setSenderEmail("podquick@erpanderp.com", "WAM - Dev Team");
			emailUtil.setSubject("International project assignment request-"+projectAssignment.getProjectAssignmentCode());

			SwingWorker worker = new SwingWorker<String, Object>() {
				@Override
				protected String doInBackground() throws Exception {
					EMAIL_MESSAGE = emailUtil.processAndSendEmail();
					return null;
				}

				@Override
				protected void done() {
						System.out.println("DONE " + EMAIL_MESSAGE);		
				}
			};
			worker.execute();
			System.out.println( "BEFORE RETURNING: " + EMAIL_MESSAGE);
			return EMAIL_MESSAGE;
		}
		
		
		//APPROVE ACTION
		public String approveInternationalProjectAssignment()
		{
			System.out.println("In  approveDomesticProjectAssignment");
			 validateFormApprove();
			if(FORM_VALID){
				System.out.println("IN APPROVE ACTION.............");
				projectAssignment.setApprovalStatus(CommonLookup.PROJECT_ASSIGNMENT_APPROVED_STATUS);
	 			if(projectAssignmentDAO.updateInternationalProjectAssignment(projectAssignment) != null ){
	 			System.out.println("In approve success....");
	 			System.out.println("AT CALLER METHOD: " + sendMessageApprove());
				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, projectAssignment.getProjectAssignmentId() + " ProjectAssignment approved successfully.", ""));
				System.out.println("In approve success....after");
				projectAssignment = new ProjectAssignment();
				projectAssignment.setProject(new Project());
				}else{
	 				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Failed to approve ProjectAssignment.", ""));
	 			}
			}
		return null;
		}
		
		//APPROVE MAIL
		public String sendMessageApprove(){
			Map<String, String> hostsMap = WAMHostManager.getWAMHosts(context);
			String domainName = context.getInitParameter("domainName");
			 
			if(hostsMap.get(CommonLookup.DEV_EMAIL) == null){
				String[] to = {projectAssignment.getEmployee().getEmail()};
				emailUtil.setRecieverAddresses(to);
			}else{
				String[] to = {hostsMap.get(CommonLookup.DEV_EMAIL)};
				emailUtil.setRecieverAddresses(to);
			}
			
			String messageString = "Dear " + projectAssignment.getEmployee().getFirstName() +" "+projectAssignment.getEmployee().getLastName() + ",<br /><br />" + 
						"<a style='color:#FF9933;font-weight: bold;'>" + "Your international project assignment-"+" "+projectAssignment.getProjectAssignmentCode() +
						" "+"is approved"+"<br /><br />"+

					    "Thanks & Regards, <br />"
					    + CommonLookup.WAM_DEVTEAM_SIGNATURE;
			 
		
			emailUtil.setMessage(messageString);
			//emailUtil.setRecieverAddresses(to);
			emailUtil.setSenderEmail("podquick@erpanderp.com", "WAM - Dev Team");
			emailUtil.setSubject("Domestic project assignment request-"+projectAssignment.getProjectAssignmentCode());

			SwingWorker worker = new SwingWorker<String, Object>() {
				@Override
				protected String doInBackground() throws Exception {
					EMAIL_MESSAGE = emailUtil.processAndSendEmail();
					return null;
				}

				@Override
				protected void done() {
						System.out.println("DONE " + EMAIL_MESSAGE);		
				}
			};
			worker.execute();
			System.out.println( "BEFORE RETURNING: " + EMAIL_MESSAGE);
			return EMAIL_MESSAGE;
		}

		
		//REJECT ACTION
		public String rejectInternationalProjectAssignment()
		{
			System.out.println("In  rejectDomesticProjectAssignment");
			validateFormReject();
			if(FORM_VALID){
				
	 			projectAssignment.setRecommendationStatus(CommonLookup.PROJECT_ASSIGNMENT_REJECTIONSTATUS_STATUS);
				projectAssignment.setApprovalStatus(CommonLookup.PROJECT_ASSIGNMENT_REJECTIONSTATUS_STATUS);
				projectAssignment.getProjectAssignmentDetails().add(projectAssignmentDetail);
				if(projectAssignmentDAO.updateProjectAssignment(projectAssignment) != null ){
					System.out.println("In reject success....");
					System.out.println("AT CALLER METHOD: " + sendMessageReject());
	 			
				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, projectAssignment.getProjectAssignmentId() + " ProjectAssignment rejected successfully.", ""));
				System.out.println("In reject success....after");
				projectAssignment = new ProjectAssignment();
				projectAssignment.setProject(new Project());
				}else{
	 				FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN, "Failed to reject ProjectAssignment.", ""));
	 			}
				
		}
		return null;
		}
		
		//REJECT MAIL
				public String sendMessageReject(){
					Map<String, String> hostsMap = WAMHostManager.getWAMHosts(context);
					if(hostsMap.get(CommonLookup.DEV_EMAIL) == null){
						String[] to = {projectAssignment.getEmployee().getEmail()};
						emailUtil.setRecieverAddresses(to);
					}else{
						String[] to = {hostsMap.get(CommonLookup.DEV_EMAIL)};
						emailUtil.setRecieverAddresses(to);
					}
					
					String messageString = "Dear " + projectAssignment.getEmployee().getFirstName()+" "+projectAssignment.getEmployee().getLastName() + ",<br /><br />" + 
								"<a style='color:#FF9933;font-weight: bold;'>" + "Your international project assignment-"+" "+projectAssignment.getProjectAssignmentCode() +
								" "+"is rejected"+"<br /><br />"+

							    "Thanks & Regards, <br />"
							    + CommonLookup.WAM_DEVTEAM_SIGNATURE;
					 
				
					emailUtil.setMessage(messageString);
					emailUtil.setSenderEmail("podquick@erpanderp.com", "WAM - Dev Team");
					emailUtil.setSubject("Domestic project assignment request-"+projectAssignment.getProjectAssignmentCode());

					SwingWorker worker = new SwingWorker<String, Object>() {
						@Override
						protected String doInBackground() throws Exception {
							EMAIL_MESSAGE = emailUtil.processAndSendEmail();
							return null;
						}

						@Override
						protected void done() {
								System.out.println("DONE " + EMAIL_MESSAGE);		
						}
					};
					worker.execute();
					System.out.println( "BEFORE RETURNING: " + EMAIL_MESSAGE);
					return EMAIL_MESSAGE;
				}

				
		
		//VALIDATION
		private void validateFormRecommend(){
			System.out.println("validateForm.....................");
			FORM_VALID = true;
			
			System.out.println("projectAssignment.getEmergencycontactNumber()....................."+projectAssignment.getEmergencycontactNumber());
			
			if(ValidationUtil.isEmpty(projectAssignment.getEmergencycontactNumber(), "Emergency Contact Number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
//			if(ValidationUtil.isEmpty(selectedProjectId.toString() , "Project", "", FacesContext.getCurrentInstance()) != null || ValidationUtil.isNonZero(selectedProjectId, "Project ", "", FacesContext.getCurrentInstance()) != null)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}

			if(ValidationUtil.isEmpty(String.valueOf(visa.getVISANumber()), "Visa number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidUpto() != null ? visa.getValidUpto().toString() :null , "ValidUpto in visa details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getType()), "Visa type in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getCountry()), "Country in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsuranceProvider()), "Insurance provider in insurance details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsurancePolicyNumber()), "Insurance policy number in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidFrom() != null ? visa.getValidFrom().toString() :null , "Valid From in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidTo() != null ? visa.getValidTo().toString() :null , "Valid To in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getWCCNumber()), "WCC number in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			System.out.println("visa.getDailyAllowance()........."+visa.getDailyAllowance());
//			if(Long.valueOf(visa.getDailyAllowance()) = 0.0)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getPayCycle()), "Payment Cycle in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(visa.getValidFrom() != null && visa.getValidTo() != null )
			{
			if(visa.getValidFrom().compareTo(visa.getValidTo())>0){
				
	    		System.out.println("FROMDATE is after TODATE");
	    		FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN," Valid From should not be more than Valid To in insurance details", ""));
	    		FORM_VALID = false;
	    	}
			}
			if(ValidationUtil.isEmpty(projectAssignment.getRecommendationRemarks(), "Recommender's Remarks ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			System.out.println("Finally FORM_VALID is :::::"+FORM_VALID);
		}
		private void validateFormApprove(){
			System.out.println("validateForm.....................");
			FORM_VALID = true;
			
			System.out.println("projectAssignment.getEmergencycontactNumber()....................."+projectAssignment.getEmergencycontactNumber());
			
			if(ValidationUtil.isEmpty(projectAssignment.getEmergencycontactNumber(), "Emergency Contact Number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
//			if(ValidationUtil.isEmpty(selectedProjectId.toString() , "Project", "", FacesContext.getCurrentInstance()) != null || ValidationUtil.isNonZero(selectedProjectId, "Project ", "", FacesContext.getCurrentInstance()) != null)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}

			if(ValidationUtil.isEmpty(String.valueOf(visa.getVISANumber()), "Visa number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidUpto() != null ? visa.getValidUpto().toString() :null , "ValidUpto in visa details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getType()), "Visa type in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getCountry()), "Country in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsuranceProvider()), "Insurance provider in insurance details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsurancePolicyNumber()), "Insurance policy number in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidFrom() != null ? visa.getValidFrom().toString() :null , "Valid From in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidTo() != null ? visa.getValidTo().toString() :null , "Valid To in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getWCCNumber()), "WCC number in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			System.out.println("visa.getDailyAllowance()........."+visa.getDailyAllowance());
//			if(Long.valueOf(visa.getDailyAllowance()) = 0.0)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getPayCycle()), "Payment Cycle in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(visa.getValidFrom() != null && visa.getValidTo() != null )
			{
			if(visa.getValidFrom().compareTo(visa.getValidTo())>0){
				
	    		System.out.println("FROMDATE is after TODATE");
	    		FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN," Valid From should not be more than Valid To in insurance details", ""));
	    		FORM_VALID = false;
	    	}
			}
			if(ValidationUtil.isEmpty(projectAssignment.getApprovalRemarks(), "Approver's Remarks ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			System.out.println("Finally FORM_VALID is :::::"+FORM_VALID);
		}
		private void validateFormReject(){
			System.out.println("validateForm.....................");
			FORM_VALID = true;
			
			System.out.println("projectAssignment.getEmergencycontactNumber()....................."+projectAssignment.getEmergencycontactNumber());
			
			if(ValidationUtil.isEmpty(projectAssignment.getEmergencycontactNumber(), "Emergency Contact Number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
//			if(ValidationUtil.isEmpty(selectedProjectId.toString() , "Project", "", FacesContext.getCurrentInstance()) != null || ValidationUtil.isNonZero(selectedProjectId, "Project ", "", FacesContext.getCurrentInstance()) != null)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}

			if(ValidationUtil.isEmpty(String.valueOf(visa.getVISANumber()), "Visa number ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidUpto() != null ? visa.getValidUpto().toString() :null , "ValidUpto in visa details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getType()), "Visa type in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getCountry()), "Country in visa details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsuranceProvider()), "Insurance provider in insurance details ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getInsurancePolicyNumber()), "Insurance policy number in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidFrom() != null ? visa.getValidFrom().toString() :null , "Valid From in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(visa.getValidTo() != null ? visa.getValidTo().toString() :null , "Valid To in insurance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getWCCNumber()), "WCC number in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			System.out.println("visa.getDailyAllowance()........."+visa.getDailyAllowance());
//			if(Long.valueOf(visa.getDailyAllowance()) = 0.0)
//			{
//				System.out.println("selectedProjectId.toString()...111111111........"+selectedProjectId.toString());
//			FORM_VALID = false;
//			}
			if(ValidationUtil.isEmpty(String.valueOf(visa.getPayCycle()), "Payment Cycle in project assignment allowance details  ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			if(visa.getValidFrom() != null && visa.getValidTo() != null )
			{
			if(visa.getValidFrom().compareTo(visa.getValidTo())>0){
				
	    		System.out.println("FROMDATE is after TODATE");
	    		FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(FacesMessage.SEVERITY_WARN," Valid From should not be more than Valid To in insurance details", ""));
	    		FORM_VALID = false;
	    	}
			if(ValidationUtil.isEmpty(projectAssignment.getApprovalRemarks(), "Approver's Remarks ", null, FacesContext.getCurrentInstance()) != null || ValidationUtil.isEmpty(projectAssignment.getRecommendationRemarks(), "Recommender's Remarks ", null, FacesContext.getCurrentInstance()) != null){
				FORM_VALID = false;
			}
			}
			System.out.println("Finally FORM_VALID is :::::"+FORM_VALID);
		}
		  
		//GETTERS AND SETTERS
		public HttpServletRequest getRequest() {
			return request;
		}

		public void setRequest(HttpServletRequest request) {
			this.request = request;
		}

		public HttpSession getSession() {
			return session;
		}

		public void setSession(HttpSession session) {
			this.session = session;
		}

		public ProjectDAO getProjectDAO() {
			return projectDAO;
		}

		public void setProjectDAO(ProjectDAO projectDAO) {
			this.projectDAO = projectDAO;
		}

		public ProjectAssignmentDAO getProjectAssignmentDAO() {
			return projectAssignmentDAO;
		}

		public void setProjectAssignmentDAO(ProjectAssignmentDAO projectAssignmentDAO) {
			this.projectAssignmentDAO = projectAssignmentDAO;
		}

		public ProjectAssignmentDetailDAO getProjectAssignmentDetailDAO() {
			return projectAssignmentDetailDAO;
		}

		public void setProjectAssignmentDetailDAO(
				ProjectAssignmentDetailDAO projectAssignmentDetailDAO) {
			this.projectAssignmentDetailDAO = projectAssignmentDetailDAO;
		}

		public ProjectAssignment getProjectAssignment() {
			return projectAssignment;
		}

		public void setProjectAssignment(ProjectAssignment projectAssignment) {
			this.projectAssignment = projectAssignment;
		}

		public ProjectAssignmentDetail getProjectAssignmentDetail() {
			return projectAssignmentDetail;
		}

		public void setProjectAssignmentDetail(
				ProjectAssignmentDetail projectAssignmentDetail) {
			this.projectAssignmentDetail = projectAssignmentDetail;
		}

		public Employee getEmployee() {
			return employee;
		}

		public void setEmployee(Employee employee) {
			this.employee = employee;
		}

		public Project getSelectedProject() {
			return selectedProject;
		}

		public void setSelectedProject(Project selectedProject) {
			this.selectedProject = selectedProject;
		}

		public WAMUser getWamUser() {
			return wamUser;
		}

		public void setWamUser(WAMUser wamUser) {
			this.wamUser = wamUser;
		}

		public Employee getReportingManager() {
			return reportingManager;
		}

		public void setReportingManager(Employee reportingManager) {
			this.reportingManager = reportingManager;
		}

		public boolean isSHOW_EDIT_DIALOG() {
			return SHOW_EDIT_DIALOG;
		}

		public void setSHOW_EDIT_DIALOG(boolean sHOW_EDIT_DIALOG) {
			SHOW_EDIT_DIALOG = sHOW_EDIT_DIALOG;
		}

		public boolean isFORM_VALID() {
			return FORM_VALID;
		}

		public void setFORM_VALID(boolean fORM_VALID) {
			FORM_VALID = fORM_VALID;
		}

		public boolean isRenderApproveReject() {
			return renderApproveReject;
		}

		public void setRenderApproveReject(boolean renderApproveReject) {
			this.renderApproveReject = renderApproveReject;
		}

		public boolean isRenderUpdate() {
			return renderUpdate;
		}

		public void setRenderUpdate(boolean renderUpdate) {
			this.renderUpdate = renderUpdate;
		}

		public boolean isRenderClose() {
			return renderClose;
		}

		public void setRenderClose(boolean renderClose) {
			this.renderClose = renderClose;
		}

		public boolean isRenderProjectsAssignmentsList() {
			return renderProjectsAssignmentsList;
		}

		public void setRenderProjectsAssignmentsList(
				boolean renderProjectsAssignmentsList) {
			this.renderProjectsAssignmentsList = renderProjectsAssignmentsList;
		}

		public boolean isRenderProjectsAssignments() {
			return renderProjectsAssignments;
		}

		public void setRenderProjectsAssignments(boolean renderProjectsAssignments) {
			this.renderProjectsAssignments = renderProjectsAssignments;
		}

		public List<ProjectAssignment> getProjectAssignmentsList() {
			return projectAssignmentsList;
		}

		public void setProjectAssignmentsList(
				List<ProjectAssignment> projectAssignmentsList) {
			this.projectAssignmentsList = projectAssignmentsList;
		}

		public List<ProjectAssignmentDetail> getProjectAssignmentDetailList() {
			return projectAssignmentDetailList;
		}

		public void setProjectAssignmentDetailList(
				List<ProjectAssignmentDetail> projectAssignmentDetailList) {
			this.projectAssignmentDetailList = projectAssignmentDetailList;
		}

		public List<PassportAndPANDetails> getPassportAndPANDetailsList() {
			return passportAndPANDetailsList;
		}

		public void setPassportAndPANDetailsList(
				List<PassportAndPANDetails> passportAndPANDetailsList) {
			this.passportAndPANDetailsList = passportAndPANDetailsList;
		}

		public List<Project> getProjects() {
			return projects;
		}

		public void setProjects(List<Project> projects) {
			this.projects = projects;
		}

		public Map<String, Long> getProjectsMap() {
			return projectsMap;
		}

		public void setProjectsMap(Map<String, Long> projectsMap) {
			this.projectsMap = projectsMap;
		}

		public String getProjectAssignmentId() {
			return projectAssignmentId;
		}

		public void setProjectAssignmentId(String projectAssignmentId) {
			this.projectAssignmentId = projectAssignmentId;
		}

		public Long getSelectedProjectId() {
			return selectedProjectId;
		}

		public void setSelectedProjectId(Long selectedProjectId) {
			this.selectedProjectId = selectedProjectId;
		}

		public String getProjectAssignmentCode() {
			return projectAssignmentCode;
		}

		public void setProjectAssignmentCode(String projectAssignmentCode) {
			this.projectAssignmentCode = projectAssignmentCode;
		}

		public String getEmployeeId() {
			return employeeId;
		}

		public void setEmployeeId(String employeeId) {
			this.employeeId = employeeId;
		}

		public String getContactNumber() {
			return contactNumber;
		}

		public void setContactNumber(String contactNumber) {
			this.contactNumber = contactNumber;
		}

		public String getPassportNumber() {
			return passportNumber;
		}

		public void setPassportNumber(String passportNumber) {
			this.passportNumber = passportNumber;
		}

		public String getApprovedBy() {
			return approvedBy;
		}

		public void setApprovedBy(String approvedBy) {
			this.approvedBy = approvedBy;
		}

		public Float getAdvanceAmount() {
			return advanceAmount;
		}

		public void setAdvanceAmount(Float advanceAmount) {
			this.advanceAmount = advanceAmount;
		}

		public Float getRoomRentAdvance() {
			return roomRentAdvance;
		}

		public void setRoomRentAdvance(Float roomRentAdvance) {
			this.roomRentAdvance = roomRentAdvance;
		}

		public Date getCreateDate() {
			return createDate;
		}

		public void setCreateDate(Date createDate) {
			this.createDate = createDate;
		}

		public String getAdditionals() {
			return additionals;
		}

		public void setAdditionals(String additionals) {
			this.additionals = additionals;
		}

		public static long getSerialversionuid() {
			return serialVersionUID;
		}

		public Journey getOnwardJourney() {
			return onwardJourney;
		}
		public void setOnwardJourney(Journey onwardJourney) {
			this.onwardJourney = onwardJourney;
		}
		public Journey getReturnJourney() {
			return returnJourney;
		}
		public void setReturnJourney(Journey returnJourney) {
			this.returnJourney = returnJourney;
		}
		public VISA getVisa() {
			return visa;
		}
		public void setVisa(VISA visa) {
			this.visa = visa;
		}
		public List<Journey> getOnwardJourneyDetails() {
			return onwardJourneyDetails;
		}
		public void setOnwardJourneyDetails(List<Journey> onwardJourneyDetails) {
			this.onwardJourneyDetails = onwardJourneyDetails;
		}
		public List<Journey> getReturnJourneyDetails() {
			return returnJourneyDetails;
		}
		public void setReturnJourneyDetails(List<Journey> returnJourneyDetails) {
			this.returnJourneyDetails = returnJourneyDetails;
		}
		public List<Journey> getOnwardJournies() {
			return onwardJournies;
		}
		public void setOnwardJournies(List<Journey> onwardJournies) {
			this.onwardJournies = onwardJournies;
		}
		public List<Journey> getReturnJournies() {
			return returnJournies;
		}
		public void setReturnJournies(List<Journey> returnJournies) {
			this.returnJournies = returnJournies;
		}
		public JourneyDAO getJourneyDAO() {
			return journeyDAO;
		}
		public void setJourneyDAO(JourneyDAO journeyDAO) {
			this.journeyDAO = journeyDAO;
		}
		public Set<Journey> getOnwardJourneyDetailsSet() {
			return onwardJourneyDetailsSet;
		}
		public void setOnwardJourneyDetailsSet(Set<Journey> onwardJourneyDetailsSet) {
			this.onwardJourneyDetailsSet = onwardJourneyDetailsSet;
		}
		public Set<Journey> getReturnJourneyDetailsSet() {
			return returnJourneyDetailsSet;
		}
		public void setReturnJourneyDetailsSet(Set<Journey> returnJourneyDetailsSet) {
			this.returnJourneyDetailsSet = returnJourneyDetailsSet;
		}

		public DataTable getAvailableOnwordJourneyDetailsTable() {
			return availableOnwordJourneyDetailsTable;
		}
		public void setAvailableOnwordJourneyDetailsTable(
				DataTable availableOnwordJourneyDetailsTable) {
			this.availableOnwordJourneyDetailsTable = availableOnwordJourneyDetailsTable;
		}
		
		public List<Journey> getAvailableOnwardJourneyDetails() {
			return availableOnwardJourneyDetails;
		}
		public void setAvailableOnwardJourneyDetails(
				List<Journey> availableOnwardJourneyDetails) {
			this.availableOnwardJourneyDetails = availableOnwardJourneyDetails;
		}
		public List<Journey> getAvailableReturnJourneyDetails() {
			return availableReturnJourneyDetails;
		}
		public void setAvailableReturnJourneyDetails(
				List<Journey> availableReturnJourneyDetails) {
			this.availableReturnJourneyDetails = availableReturnJourneyDetails;
		}
		public DataTable getAvailableReturnJourneyDetailsTable() {
			return availableReturnJourneyDetailsTable;
		}
		public void setAvailableReturnJourneyDetailsTable(
				DataTable availableReturnJourneyDetailsTable) {
			this.availableReturnJourneyDetailsTable = availableReturnJourneyDetailsTable;
		}
		public ServletContext getContext() {
			return context;
		}

		public void setContext(ServletContext context) {
			this.context = context;
		}

		public VisaDAO getVisaDAO() {
			return visaDAO;
		}

		public void setVisaDAO(VisaDAO visaDAO) {
			this.visaDAO = visaDAO;
		}



		public boolean isRenderApprove() {
			return renderApprove;
		}



		public void setRenderApprove(boolean renderApprove) {
			this.renderApprove = renderApprove;
		}



		public boolean isRenderRecommend() {
			return renderRecommend;
		}



		public void setRenderRecommend(boolean renderRecommend) {
			this.renderRecommend = renderRecommend;
		}



		public boolean isRenderReject() {
			return renderReject;
		}



		public void setRenderReject(boolean renderReject) {
			this.renderReject = renderReject;
		}

		public EmailUtil getEmailUtil() {
			return emailUtil;
		}

		public void setEmailUtil(EmailUtil emailUtil) {
			this.emailUtil = emailUtil;
		}
		public JourneyDAO getOnwardJourneyDAO() {
			return onwardJourneyDAO;
		}

		public void setOnwardJourneyDAO(JourneyDAO onwardJourneyDAO) {
			this.onwardJourneyDAO = onwardJourneyDAO;
		}

		public JourneyDAO getReturnJourneyDAO() {
			return returnJourneyDAO;
		}

		public void setReturnJourneyDAO(JourneyDAO returnJourneyDAO) {
			this.returnJourneyDAO = returnJourneyDAO;
		}

		public String getEMAIL_MESSAGE() {
			return EMAIL_MESSAGE;
		}

		public void setEMAIL_MESSAGE(String eMAIL_MESSAGE) {
			EMAIL_MESSAGE = eMAIL_MESSAGE;
		}

		public TimeZone getDefaultTimeZone() {
			return defaultTimeZone;
		}

		public void setDefaultTimeZone(TimeZone defaultTimeZone) {
			this.defaultTimeZone = defaultTimeZone;
		}
		public EmployeeProject getEmployeeProject() {
			return employeeProject;
		}

		public void setEmployeeProject(EmployeeProject employeeProject) {
			this.employeeProject = employeeProject;
		}

		public EmployeeProjectDAO getEmployeeProjectDAO() {
			return employeeProjectDAO;
		}

		public void setEmployeeProjectDAO(EmployeeProjectDAO employeeProjectDAO) {
			this.employeeProjectDAO = employeeProjectDAO;
		}

		public List<EmployeeProject> getEmployeeProjects() {
			return employeeProjects;
		}

		public void setEmployeeProjects(List<EmployeeProject> employeeProjects) {
			this.employeeProjects = employeeProjects;
		}


	}
